<template>
  <div class="cockpit-container" :style="{ transform: domScale }">
    <!-- 头部 -->
    <HeaderTop />
    <el-row type="flex" justify="space-between" class="cockpit-content">
      <div class="left box-bg">
        <!-- 综合投后分析（财务类指标） -->
        <Financial />
        <!-- 综合投后分析（非财务类指标） -->
        <UnFinancial />
        <!-- 行业分布 -->
        <Industry />
      </div>
      <div class="middle">
        <DataView />
        <!-- 项目情况 -->
        <ProductInfo />
        <el-row type="flex" justify="space-between">
          <!-- 风险趋势 -->
          <RiskTrends />
          <!-- 市场信息 -->
          <MarketInfo />
        </el-row>
      </div>
      <div class="right box-bg">
        <!-- 投资阶段 -->
        <Investment />
        <!-- 项目推进进度 -->
        <ProductProgress />
      </div>
    </el-row>
  </div>
</template>

<script>
import HeaderTop from "./components/HeaderTop/index.vue";
import Financial from "./components/Financial/index.vue";
import UnFinancial from "./components/UnFinancial/index.vue";
import Industry from "./components/Industry/index.vue";
import DataView from "./components/DataView/index.vue";
import ProductInfo from "./components/ProductInfo/index.vue";
import RiskTrends from "./components/RiskTrends/index.vue";
import MarketInfo from "./components/MarketInfo/index.vue";
import Investment from "./components/Investment/index.vue";
import ProductProgress from "./components/ProductProgress/index.vue";

export default {
  name: "CockpitPage",
  components: {
    HeaderTop,
    Financial,
    UnFinancial,
    Industry,
    DataView,
    ProductInfo,
    RiskTrends,
    MarketInfo,
    Investment,
    ProductProgress,
  },
  data() {
    return {
      scale: { x: 1, y: 1 },
    };
  },

  computed: {
    domScale: function () {
      const scale = this.scale;
      return "scale(" + scale.x + "," + scale.y + ")";
    },
  },
  mounted() {
    this.onResiz();
  },
  beforeMount() {
    window.addEventListener("resize", this.onResiz);
  },
  beforeDestroy() {
    window.removeEventListener("resize", this.onResiz);
  },
  methods: {
    onResiz() {
      const x = window.innerWidth / 1920;
      const y = window.innerHeight / 1080;
      this.scale = { x, y };
    },
  },
};
</script>

<style lang="scss">
.cockpit-container {
  font-size: 14px;
  font-weight: 400;
  font-family: Source Han Sans CN, Source Han Sans CN;
  * {
    font-size: 14px;
  }
  ul,
  li {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .box-bg {
    background: linear-gradient(
      360deg,
      rgba(22, 62, 112, 0.3) 0%,
      #18386c 100%
    );
  }
  .red {
    color: #e54246;
  }
  .green {
    color: #22d9db;
  }
  .blue {
    color: #58b2ff;
    font-weight: 500;
  }
  .yellow {
    color: #efa451;
    font-weight: 500;
  }
  .grey {
    color: #c4ccd7;
  }
  .text-gradient {
    font-weight: bold;
    background: linear-gradient(175deg, #9acdfd 0%, #66acff 46%, #abebff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .text-right {
    text-align: right;
  }
  .pointer {
    cursor: pointer;
  }
  .underline {
    text-decoration: underline;
  }
  .flex-trwice {
    flex: 2;
  }
  .h40 {
    height: 40px;
  }
  // el-row
  .table-box {
    color: #c6cdd8;

    .el-col {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: end;
      min-height: 40px;
      padding: 10px 0;
      line-height: 16px;
      &:first-child {
        padding-left: 24px;
        text-align: left;
      }
      &:last-child {
        padding-right: 24px;
      }
    }
    .head {
      font-weight: bold;
      line-height: 16px;
      background: linear-gradient(
        175deg,
        #9acdfd 0%,
        #66acff 46%,
        #abebff 100%
      );
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    .body {
      &:nth-child(even) {
        background: #1b3661;
      }
      .el-col:first-child {
        align-items: start;
      }
    }
  }
}
// select-dropdown
.el-select-dropdown {
  border: none;
  background-color: #0e2344;
}
.el-select-dropdown__item {
  color: #ffffff;
}
.el-select-dropdown__item.hover,
.el-select-dropdown__item:hover {
  background: #204c80;
}
// .el-radio
.el-radio {
  color: #c4ccd7;
}
.el-radio__inner {
  border: 1px solid #233c64;
  width: 16px;
  height: 16px;
  background: rgba(7, 20, 41, 0.62);
}
.el-radio__input.is-checked .el-radio__inner {
  border-color: #3d7fe9;
  background: #3d7fe9;
}
.el-radio__inner::after {
  background: rgba(7, 20, 41, 0.62);
}
// el-checkbox
.el-checkbox__inner {
  width: 16px;
  height: 16px;
  background: rgba(7, 20, 41, 0.62);
  border: 1px solid #233c64;
  border-radius: 2px;
}
.el-checkbox__input.is-indeterminate .el-checkbox__inner::before {
  top: 6px;
  background-color: #233c64;
}
.el-checkbox__inner::after {
  left: 5px;
  top: 2px;
  border-bottom: 2px solid #233c64;
  border-right: 2px solid #233c64;
}
.el-checkbox__input.is-checked .el-checkbox__inner,
.el-checkbox__input.is-indeterminate .el-checkbox__inner {
  background: #3d7fe9;
  color: #c4ccd7;
}
.el-checkbox__label {
  font-size: 14px;
  font-family: Source Han Sans CN, Source Han Sans CN;
  font-weight: 400;
  color: #c4ccd7;
  line-height: 16px;
}
// 弹窗
.cockpit-dialog {
  background: #0c264d;
  .el-dialog__headerbtn .el-dialog__close {
    font-size: 26px;
  }
  .title {
    position: relative;
    span {
      font-size: 24px;
      font-weight: 800;
      color: #ffffff;
      line-height: 28px;
      letter-spacing: 1px;
      position: relative;
      z-index: 5;
    }
    &::after {
      position: relative;
      top: 1px;
      left: -12px;
      z-index: 1;
      display: inline-block;
      content: "";
      width: 57px;
      height: 20px;
      background: linear-gradient(
        270deg,
        rgba(3, 42, 113, 0) 0%,
        #048ed2 79%,
        rgba(4, 142, 210, 0) 100%
      );
    }
  }

  .el-dialog__header {
    padding: 25px 55px 10px;
  }
  .el-dialog__body {
    padding: 0 55px 30px;

    // el-table
    .el-table {
      color: #c4ccd7;
      .el-table__row:nth-child(odd) {
        background: #1d355d;
      }
    }

    .el-table th,
    .el-table tr,
    .el-table,
    .el-table__expanded-cell,
    .el-table--enable-row-hover .el-table__body tr:hover > td {
      background-color: transparent;
    }
    .el-table td,
    .el-table th.is-leaf {
      border-bottom: none;
    }
    .el-table--border::after,
    .el-table--group::after,
    .el-table::before {
      content: none;
    }
  }
}
</style>

<style lang="scss" scoped>
.cockpit-container {
  position: relative;
  width: 1920px;
  height: 1080px;
  background: #0a1e3e;
  transform-origin: left top;
  overflow: hidden;
  color: #c4ccd7;
  box-sizing: border-box;
  .cockpit-content {
    width: 100%;
    height: 972px;
    margin-top: -75px;
    padding: 0 30px;
    .left {
      width: 400px;
      height: 100%;
    }
    .middle {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      width: 1020px;
      height: 100%;
      padding-top: 55px;
    }
    .right {
      width: 400px;
      height: 100%;
    }
  }
}
</style>
